Skip to main content

SUMBY

Sums the values of a specified property in an array of objects.

Syntax

SUMBY(array, property)

Arguments

  • array: The array or collection to iterate over.
  • property: The property name of the values to sum.

Example

SUMBY(A1:A5, "value") → Returns the sum of the "value" property for all objects in the range A1:A5.
SUMBY([{value: 10, id: 1}, {value: 5, id: 2}, {value: 15, id: 1}], "value") → Returns 30.

Usage Notes:

  • If the array is empty, the function returns 0.
  • If an object in the array does not have the specified property, it is treated as 0 for the summation.
  • The function assumes that the property values are numeric.